package com.demo.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.demo.dto.EasyUIGrid;
import com.demo.dto.EasyUIPage;
import com.demo.dto.Params;
import com.demo.service.UserService;

@Controller
@RequestMapping(value = "/user")
public class UserController {

	@Resource
	private UserService userService;
	
	@RequestMapping(value = "/manage", method = RequestMethod.GET)
	public ModelAndView index(ModelAndView modelAndView) {
		modelAndView.setViewName("user/manage");
		return modelAndView;
	}
	
	@ResponseBody
	@RequestMapping(value = "/findByParams", method = RequestMethod.GET)
	public EasyUIGrid findByParams(EasyUIPage page, Params params) {
		return userService.findByParams(page, params.getMap());
	}
}
